import React from 'react';

export default class RefTest extends React.Component{
    constructor(props){
        super(props);
        this.state={
            msg:""
        }
    }
    getChange=()=>{
        this.setState({
            msg:this.refs.qwer.value
        })
    }
    getMsg=()=>{
        console.log(this.state.msg)
    }
    render(){
        return(
            <div>
                <input ref="qwer" onChange={this.getChange}/>
                <button onClick={this.getMsg}>第二种方式获取表单的值</button>
            </div>
        )
    }
}